package com.lotterymanage.service.impl;

import com.lotterymanage.domain.SystemIP;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lotterymanage.common.CheckIP;
import com.lotterymanage.dao.SystemDao;
import com.lotterymanage.service.SystemService;

/**
 * 系统ip service实现类.
 * @author lxz
 * @date Apr 20, 2010
 */
@Service("systemService")
public class SystemServiceImpl implements SystemService {

    @Autowired
    private SystemDao systemDao;
    /**
     * 验证IP是否合法.
     * @param ip String
     * @return true false
     */
    public boolean isValidIp(final String ip) {
        CheckIP cip = new CheckIP();
        SystemIP ipm = systemDao.getCheckIP();
        if (!cip.check(ip, ipm)) {
            return false;
        }
        return true;
    }
}
